package com.tanhua.admin.task;


import com.tanhua.admin.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class AnalysisTask {


    @Autowired
    private AnalysisService analysisService;

    //@Scheduled(cron = "0/10 * * * * ?")
    public void analysis(){

        String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        System.out.println("当前时间"+format);

        //定时统计log表数据，写入到统计表中
        try {
            analysisService.analysis();
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
